{extend name="base/base" /}
{block name="main"}
<style>
    .layui-form-pane .layui-form-label{width: 160px;}
    .layui-form-pane .layui-input-block{
        margin-left: 160px;
    }
</style>
<form id="form" method="post" class="layui-form layui-form-pane" action="{:url('/admin/helpConfig')}">


    <div class="layui-form-item">
        <label class="layui-form-label">文字描述</label>
        <div class="layui-input-block">
            <textarea name="help_config" id="about" lay-verify="abouts" style="width:100%;height:400px;">{$data.value|raw}</textarea>
        </div>
    </div>


    <div class="layui-form-item" style="padding-bottom: 30px">
        <div class="layui-input-block">
            <input type="hidden" name="__token__" id="token" value="{$Request.token}"/>
            <button class="layui-btn" lay-submit lay-filter="*">立即提交</button>
        </div>
    </div>
</form>
{/block}
{block name="script"}
{css href="/form-select/formSelects-v4.css" /}
<script>
    layui.config({
        base: '/form-select/' //此处路径请自行处理, 可以使用绝对路径
    }).extend({
        formSelects: 'formSelects-v4'
    });

    
    layui.use(['form', 'jquery', 'formSelects','upload','layedit'], function () {
        var formSelects = layui.formSelects, form = layui.form, $ = layui.jquery,upload = layui.upload;

        var layedit = layui.layedit;
        layedit.set({
            uploadImage: {  //上传图片的设置
                url: "{:url('/admin/upload')}" //接口url
                ,type: 'post' //默认post
            }
        });
        var about = layedit.build('about'); //建立编辑器
       
		 //表单验证
        form.verify({
            abouts: function(value) {
                return layedit.sync(about);
            }
        });
        
         
        //表单提交
        form.on("submit(*)", function (data) {
            var obj = $(this);
            obj.attr("disabled", "disabled").addClass("layui-disabled");
            $.post(data.form.action, data.field, function (data) {
                var icon = 5;
                if (data.code) {
                    icon = 6;
                }
                layer.msg(data.msg, {icon: icon, time: 1500}, function () {   //提示的插件，可以使用alert代替
                    if (data.code) {
                        setTimeout(function () {
                            //刷新页面
                            location.reload();
                        }, 500);
                    } else {
                        $('#token').val(data.data.token);
                        obj.removeAttr("disabled").removeClass("layui-disabled");
                    }
                });
            }, 'json');
            return false;
        });
    });



</script>
{/block}